package com.hnucm.ktstudy.base

/**
 * kotlin对象类  单例类
 */
fun main(){
    Tool.a()
    println(Tool.name)

}

//没有构造函数
object Tool{
    //延迟初始化，向编译器保证此属性绝不为空
    //否则会抛出异常
    //Exception in thread "main" kotlin.UninitializedPropertyAccessException: lateinit property name has not been initialized
    var name:String = "tool";
    fun a(){}

    fun b(){}
}